import {
	MEditViewActionType,
	IMEditViewAbility,
	IMEditViewController,
	IMEditViewControllerParams,
	IMEditViewModel,
	IMEditViewStore,
	IParam,
	IViewEvent,
} from '@/core';
import { QXEvent } from 'qx-util';
import {
	getViewClassNames,
	useViewAction,
	useViewBasic,
	useViewControllerParams,
	useViewProps,
} from '../use-view';

/**
 * 获取多编辑表单视图输入参数
 *
 * @export
 * @return {*}
 */
export function useMEditViewProps() {
	return {
		...useViewProps(),
	};
}

/**
 * 获取多编辑表单视图基础
 *
 * @export
 * @param {IMEditViewModel} model 多编辑表单视图模型
 * @param {IParam} props 输入参数
 * @return {*}
 */
export function useMEditViewBasic(model: IMEditViewModel, props: IParam) {
	const getClassNames = (props: IParam) => {
		return getViewClassNames(model, props);
	};
	return {
		...useViewBasic(model, props),
		getClassNames,
	};
}

/**
 * 多编辑表单视图行为
 *
 * @export
 */
export function useMEditViewAction(
	controller: IMEditViewController<IMEditViewStore, IMEditViewAbility>
) {
	return {
		...useViewAction(controller),
	};
}

/**
 * 获取多编辑表单视图控制器输入参数
 *
 * @export
 * @param {IMEditViewModel} model
 * @param {IParam} props
 * @param {QXEvent<IViewEvent<MEditViewActionType, IMEditViewAbility>>} evt
 * @return {*}  {IMEditViewControllerParams<MEditViewActionType, IMEditViewAbility>}
 */
export function useMEditViewControllerParams(
	model: IMEditViewModel,
	props: IParam,
	evt: QXEvent<IViewEvent<MEditViewActionType, IMEditViewAbility>>
): IMEditViewControllerParams<MEditViewActionType, IMEditViewAbility> {
	return {
		...useViewControllerParams<IMEditViewStore, IMEditViewModel>(
			model,
			props,
			evt
		),
	};
}
